#define DEBUG
#include <cstdio>
#define MAXN 50000
#define MAXM 50000
#define MAXK 16

using namespace std;

class Graph {
public:
  int n, m, ind[MAXN+1], to[2*MAXN-1], len[2*MAXN-1], link[2*MAXN-1], f[MAXN+1][MAXK+1][2], dep[MAXN+1];

  void addSide(int u, int v, int l) {
    m++;
    to[m] = v;
    len[m] = l;
    link[m] = ind[u];
    ind[u] = m;
  }

  void initDep(int o, int fa) {
    dep[o] = dep[fa]+1;
    if (!fa) {
      f[o][0][0] = o;
      f[o][0][1] = 0;
    }
    for (int i=ind[o]; i; i=link[i]) {
      if (to[i]!=fa) {
	initDep(to[i], o);
	f[to[i]][0][0] = o;
	f[to[i]][0][1] = len[i];
      }
    }
  }

  void init() {
    initDep(1, 0);
    for (int i=1; i<=MAXK; i++) {
      for (int j=1; j<=n; j++) {
	f[j][i][0] = f[f[j][i-1][0]][i-1][0];
	f[j][i][1] = f[j][i-1][1]+f[f[j][i-1][0]][i-1][1];
      }
    }
  }
};

class Set {
public:
  int a[MAXM+1];

  void init(int n) {
    for (int i=1; i<=n; i++) {
      a[i] = i;
    }
  }

  int getFa(int o) {
    if (a[o]!=o) {
      a[o] = getFa(a[o]);
    }
    return a[o];
  }

  void merge(int x, int y) {
    if (getFa(x)!=getFa(y)) {
      a[getFa(x)] = getFa(y);
    }
  }
};

void sort(int a[][2], int l, int r) {
  int i=l, j=r, mid=a[(l+r)/2][0], temp;
  for (; i<=j; ) {
    for (; a[j][0]>mid; j--);
    for (; a[i][0]<mid; i++);
    if (i<=j) {
      for (int k=0; k<2; k++) {
	temp=a[i][k], a[i][k]=a[j][k], a[j][k]=temp;
      }
      i++, j--;
    }
  }
  if (i<r) {
    sort(a, i, r);
  }
  if (j>l) {
    sort(a, l, j);
  }
}

bool check(int o, int fa, const Graph *g, const bool *army) {
  bool ret=true;
  if (!army[o]) {
    for (int i=g->ind[o]; i && ret; i=g->link[i]) {
      if (g->to[i]!=fa) {
	ret = ret && check(g->to[i], o, g, army);
      }
    }
  }
  return ret;
}

bool move(long long limit, const Graph *g, const int *army) {
  static int tarmy[MAXM+1], rootar[MAXM+1][2], need[MAXM+1][2];
  static bool book[MAXN+1];
  for (int i=1; i<=g->n; i++) {
    book[i] = false;
  }
  rootar[0][0] = 0;
  for (int i=1; i<=army[0]; i++) {
    tarmy[i] = army[i];
    long long temp=limit;
    for (int j=MAXK; j>0; j--) {
      if (temp>=g->f[tarmy[i]][j][1] && g->f[tarmy[i]][j][0]>1) {
	temp -= g->f[tarmy[i]][j][1];
	tarmy[i] = g->f[tarmy[i]][j][0];
      }
    }
    if (temp>g->f[tarmy[i]][0][0]) {
      temp -= g->f[tarmy[i]][0][0];
      rootar[++rootar[0][0]][0] = temp;
      rootar[rootar[0][0]][1] = tarmy[i];
      tarmy[i] = 1;
    }
    book[tarmy[i]] = true;
  }
  sort(rootar, 1, rootar[0][0]);

  need[0][0]=0;
  for (int i=g->ind[1]; i; i=g->link[i]) {
    if (check(g->to[i], 1, g, book)) {
      need[++need[0][0]][0] = g->len[i];
      need[need[0][0]][1] = g->to[i];
    }
  }
  sort(need, 1, need[0][0]);
  
  static int ind[MAXN+1];
  static bool used[MAXM+1];
  for (int i=1; i<=g->n; i++) {
    ind[i] = 0;
  }
  for (int i=1; i<=rootar[0][0]; i++) {
    if (!ind[rootar[i][1]]) {
      ind[rootar[i][1]] = i;
    }
    used[i] = false;
  }
  for (int i=need[0][0]; i>0; i--) {

  }
}

int main() {
#ifdef DEBUG
  freopen("3104.in", "r", stdin);
  freopen("3104.out", "w", stdout);
#endif

  static Graph g;
  int n;
  long long temp=0;
  scanf("%d", &n);
  g.n = n;
  for (int i=1; i<n; i++) {
    int u, v, w;
    scanf("%d %d %d", &u, &v, &w);
    g.addSide(u, v, w);
    g.addSide(v, u, w);
    temp += w;
  }
  g.init();

  static int army[MAXM+1];
  scanf("%d", army);
  for (int i=1; i<=army[0]; i++) {
    scanf("%d", army+i);
  }

  long long ans=-1;
  for (long long l=0, r=temp, mid; l<=r; ) {
    mid = (l+r)/2;
    if (move(mid, &g, army)) {
      ans = mid;
      r = mid-1;
    } else {
      l = mid+1;
    }
  }

  printf("%d\n", ans);

  fcloseall();
  return 0;
}
